package cn.hp.controller;

import cn.hp.entity.RoleMenu;
import cn.hp.service.RoleMenuService;
import cn.hp.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/userRole")
public class UserRoleController{
    @Autowired
    private RoleMenuService roleMenuService;

    public Result getUserRole(RoleMenu userRole) {
        List<RoleMenu> list = roleMenuService.selectRoleMenuList(userRole);
        Integer[] uid = new Integer[list.size()];
        for (int i = 0; i < list.size(); i++) {
            uid[i] = list.get(i).getRoleId();
        }
        return Result.success(uid);
    }
}